/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import React, { forwardRef } from "react";
import { Row, Col } from "antd";
import NumberDelay from "@/components/NumberDelay";
import classNames from "classnames";
import styles from "./UpOrDown.less";

const UpOrDown = forwardRef(({ rate = 0, ...rest }, ref) => {
  return (
    <Row type="flex" justify="start" align="middle" className={styles.content} ref={ref} {...rest}>
      <Col
        style={{ color: rate > 0 ? "#fb497c" : "#57cf74", flex: 1 }}
        className={classNames(rate > 0 ? styles.up : styles.down)}
      >
        <NumberDelay format={rate != 0 ? "0,0.00" : ""} number={Math.abs(rate)} /> %
      </Col>
    </Row>
  );
});

export default UpOrDown;
